/*package com.ultrasoft.farmasoft.service;

public class CompanyTransactionServiceImpl {

}*/
package com.ultrasoft.farmasoft.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ultrasoft.farmasoft.domain.Parameter;
import com.ultrasoft.farmasoft.domain.Pharmacy;
import com.ultrasoft.farmasoft.repository.AccountReceivableDao;
import com.ultrasoft.farmasoft.repository.AccountsPayableDao;
import com.ultrasoft.farmasoft.repository.BillDao;
import com.ultrasoft.farmasoft.repository.ClientDao;
import com.ultrasoft.farmasoft.repository.DosageDao;
import com.ultrasoft.farmasoft.repository.ItemDao;
import com.ultrasoft.farmasoft.repository.LocalityDao;
import com.ultrasoft.farmasoft.repository.OperationDao;
import com.ultrasoft.farmasoft.repository.PackageDao;
import com.ultrasoft.farmasoft.repository.PaymentPlanDao;
import com.ultrasoft.farmasoft.repository.PharmacyDao;
import com.ultrasoft.farmasoft.repository.ParameterDao;
import com.ultrasoft.farmasoft.repository.PharmacyProductDao;
import com.ultrasoft.farmasoft.repository.RegionDao;
import com.ultrasoft.farmasoft.repository.TransactionDao;
import com.ultrasoft.farmasoft.repository.UserDao;
import com.ultrasoft.farmasoft.repository.UserPharmacyDao;

@Service
public class CompanyOperationsServiceImpl implements CompanyOperationsService {
	
	private PharmacyDao pharmacyDao;
	private ParameterDao parameterDao;

	/*Constructor important not to forget*/
	@Autowired  
	public CompanyOperationsServiceImpl(PharmacyDao pharmacyDao, ParameterDao parameterDao){
		
		this.pharmacyDao 			= pharmacyDao;
		this.parameterDao			= parameterDao;
	}
	/*Pharmacy*/
	@Transactional(readOnly = true)    
	public List<Pharmacy> getListPharmacies(){
		return pharmacyDao.getListPharmacy();
	}
	
	@Transactional(readOnly = true)
	public List<Pharmacy> getOneListPharmacy(Integer idPharmacy){
		return pharmacyDao.getListPharmacyOne(idPharmacy);
	}
	
	@Transactional
	public void updatePharmacy(Pharmacy pharmacy) {
		pharmacyDao.update(pharmacy);
	}
	
	@Transactional
	public void removePharmacy(Pharmacy pharmacy){
		pharmacyDao.remove(pharmacy);
	} 
	
	@Transactional
	public void addPharmacy(Pharmacy pharmacy){
	    pharmacyDao.add(pharmacy);
	}
	
	@Transactional(readOnly = true)
	public Pharmacy searchPharmacyByID(Integer idPharmacy){
    	return pharmacyDao.findByPharmacyId(idPharmacy);
    }

	/*PARAMETER*/
	@Transactional(readOnly = true)
	public List<Parameter> getListParameter() {
		return parameterDao.getParameterList();
	}
	
	@Transactional(readOnly = true)
	public List<Parameter> getListParameterWithIdPharmacy(Integer idPharmacy){
		return parameterDao.getParameterListWhitPharmacyId(idPharmacy);
	}

	@Transactional(readOnly = true)
	public List<Parameter> getDistParameterWithIdTypeParameterIdPharmacy(Integer idPharmacy) {
		return parameterDao.getParamaterDistinctTypeParameterPharmacy(idPharmacy);
	}

	@Transactional(readOnly = true)
	public List<Parameter> getListParameterWithIdTypeParameterIdPharmacy(Short idTypeParameter, Integer idPharmacy) {
		return parameterDao.getParameterWithIdTypeParameterIdPharmacy(idTypeParameter, idPharmacy);
	}

	@Transactional(readOnly = true)
	public Parameter searchParameterById(Short idParameter) {
		return parameterDao.findParameterByID(idParameter);
	}

	@Transactional
	public void updateParameter(Parameter parameter) {
		parameterDao.update(parameter);
	}

	@Transactional
	public void removeParameter(Parameter parameter) {
		parameterDao.remove(parameter);
	}

	@Transactional
	public void addParameter(Parameter parameter) {
		parameterDao.add(parameter);	
	}
}


